package Tydzien1Test;
import static org.junit.Assert.*;

import java.util.Arrays;
import java.util.List;

import org.junit.Test;

import Tydzien1.PascalTriangle;


public class PascalTriangleTest {

	@Test
	public void testComputeZero() {
		PascalTriangle instance = new PascalTriangle();
		instance.compute(0);
		
		assertEquals(instance.get(0, 0), 0);
	}

	@Test
	public void testComputeOne() {
		PascalTriangle instance = new PascalTriangle();
		instance.compute(1);
		
		assertEquals(instance.get(0, 0), 1);
	}
	
	@Test
	public void testComputeFour() {
		PascalTriangle instance = new PascalTriangle();
		List<List<Integer>> exactTriangle = Arrays.asList(Arrays.asList(1),
														  Arrays.asList(1,1),
														  Arrays.asList(1,2,1),
														  Arrays.asList(1,3,3,1));
		instance.compute(7);
		for(int i = 0; i < 4; ++i)
		{
			for(int j = 0; j <= i; ++j)
			{
				assertEquals(instance.get(i, j),exactTriangle.get(i).get(j).intValue());
			}
		}
	}
	
	@Test
	public void testComputeMinusThree() {
		PascalTriangle instance = new PascalTriangle();
		instance.compute(-3);
		
		assertEquals(instance.get(0, 0), 0);
	}

}
